package com.yy.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.Objects;

/**
 * @Author: yy
 * @Date 2021/11/14 12:47
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Accessors(chain = true)
@TableName("role")
public class Role {
    private String roleId;
    private String roleName;
    private String roleDescribe;

    @TableField(exist = false)
    private List<Power> powers;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Role)) {
            return false;
        }
        Role role = (Role) o;
        return Objects.equals(getRoleId(), role.getRoleId()) && Objects.equals(getRoleName(), role.getRoleName()) && Objects.equals(getRoleDescribe(), role.getRoleDescribe()) && Objects.equals(getPowers(), role.getPowers());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getRoleId(), getRoleName(), getRoleDescribe(), getPowers());
    }
}
